fix(stack): surface fetch_old_pr_heads failures instead of swallowing#1315
Merged
mergify[bot] merged 2 commits intomainfrom Apr 30, 2026
Conversation
Member
Author
|
This pull request is part of a Mergify stack:
|
Contributor
Merge ProtectionsYour pull request matches the following merge protections and will not be merged until they are valid. 🟢 ⛓️ Depends-On RequirementsWonderful, this rule succeeded.Requirement based on the presence of
🟢 🤖 Continuous IntegrationWonderful, this rule succeeded.
🟢 👀 Review RequirementsWonderful, this rule succeeded.
🟢 Enforce conventional commitWonderful, this rule succeeded.Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 ReviewsWonderful, this rule succeeded.
🟢 📕 PR descriptionWonderful, this rule succeeded.
|
c36d11f to
cdaab37
Compare
Member
Author
Revision history
|
There was a problem hiding this comment.
Pull request overview
This PR makes stack push surface failures from fetch_old_pr_heads (used for revision-history change-type detection) instead of silently swallowing them, while keeping the behavior non-fatal.
Changes:
- Capture
utils.CommandErrorfromfetch_old_pr_headsand log the underlying failure. - Keep revision-history classification behavior unchanged (fallback remains
"unknown"on fetch failure).
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
`CommandError.__str__` decoded captured stdout as strict UTF-8, so any non-UTF-8 bytes from a subprocess (legacy locales, binary diff fragments, truncated multi-byte sequences) would turn `str(error)` into a `UnicodeDecodeError`. Every error-formatting site is affected — the top-level CLI handler in `cli.py:104`, log messages, etc. — converting the failure into an unhandled traceback instead of a clean message. Switch to `decode(errors="replace")`. Invalid bytes become the U+FFFD replacement character; all other formatting is preserved. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: I3e3fd853218a6c4294b17e9529794320288124e5
The exception handler around `fetch_old_pr_heads` previously did a silent `pass`, leaving every revision-history entry stamped "unknown" with no clue why. When a real failure happens (fork remote without `refs/pull/N/head`, network error, missing permissions, …) the user has no signal that anything went wrong — they only see the symptom in the PR comment days later. Log the underlying error in orange so the cause is visible at push time. The exception text is run through `rich.markup.escape` so any `[`/`]` in the git error message is rendered literally rather than parsed as Rich markup. Behaviour stays non-fatal: classification still falls back to "unknown" and the push proceeds. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> Change-Id: Id33459ea069be228f73fb02a7f813f16db145b71
cdaab37 to
525f374
Compare
Base automatically changed from
devs/jd/fix/stack-revision-history-fetch-resilience/decode-commanderror-stdout-safely-str-never-raises--3e3fd853
to
main
April 29, 2026 17:14
JulianMaurin
approved these changes
Apr 29, 2026
remyduthu
approved these changes
Apr 30, 2026
Contributor
Merge Queue Status
This pull request spent 8 minutes 11 seconds in the queue, including 7 minutes 52 seconds running CI. Required conditions to merge
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The exception handler around
fetch_old_pr_headspreviously did asilent
pass, leaving every revision-history entry stamped"unknown" with no clue why. When a real failure happens (fork remote
without
refs/pull/N/head, network error, missing permissions, …)the user has no signal that anything went wrong — they only see the
symptom in the PR comment days later.
Log the underlying error in orange so the cause is visible at push
time. The exception text is run through
rich.markup.escapeso any[/]in the git error message is rendered literally rather thanparsed as Rich markup. Behaviour stays non-fatal: classification
still falls back to "unknown" and the push proceeds.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
Depends-On: #1316